<template>
	<div id="notesAdd">
		<v-title :title='title' :text1='text1' :value1='value1' :text2='text2' :value2='value2' :isShow='isShow'></v-title>
		<div class="notes-cont">
			<el-form ref="form" label-width="100px">
				<el-form-item label="查看规则：" prop="coerce">
					<el-radio-group v-model="radioChecked" :value="radioChecked">
						<el-radio label="1">不强制查看</el-radio>
						<el-radio label="2">每天强制查看</el-radio>
						<el-radio label="3">每次强制查看</el-radio>
						<el-tooltip class="item" effect="dark"  placement="bottom">
							<div slot="content" style="line-height: 1.6;padding: 10px;">
								<p>强制查看定义：用户在没有阅读预约须知之前不可使用预约功能</p>
								<p>不强制 查看：用户每次使用网点预约功能不提示查看预约须知。</p>
								<p>每天强制查看：用户每天首次使用预约功能提示查看预约须知。</p>
								<p>每次强制查看：用户每次使用预约功能都提示查看预约须知。</p>
							</div>
							<i class="el-icon-info" ></i>
						</el-tooltip>
					</el-radio-group>
				</el-form-item>
				<el-form-item label="业务描述：" prop="desc">
					<el-input class="custom-textarea" type="textarea" placeholder="业务描述，子业务类型以及办理业务所需材料。"  v-model="desc">
					</el-input>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" class="custom-btn" @click="onsubmit">提交</el-button>
				</el-form-item>
			</el-form>
			
		</div>
	</div>
</template>
<script>
	import vTitle from './view/titleDiv.vue'
	import {addNotes} from "../api/getData"
	export default {
		name: '',
		components: {
			vTitle
		},
		data() {
			return {
				title: '新建预约须知',
				text1: '创建人：',
				value1: '',
				text2: '创建时间：',
				value2: '',
				isShow: false,
				notes:{},
				radioChecked:'',
				desc:''
			}
		},
		watch:{
			
		},
		created() {}, // 创建时
		beforeMount() {}, // 挂载之前
		mounted() {}, // 挂载之后
		beforeUpdate() {}, // 数据更新时调用,在渲染之前
		updated() {}, // 数据更新后,渲染后调用(禁止)
		beforeDestroy() {}, // 实例销毁前调用,解绑中间层的数据传输
		destroyed() {}, // 实例销毁后调用
		methods: {
			onsubmit(){
				// console.log(this.desc.split("\n"))
				addNotes({
					'notes': this.desc,
					'viewnotes':this.radioChecked
				}).then((res) =>{
					console.log(res.data,"新建预约须知成功")
					if(res.data.code == 0 ){
						this.$message({
						message: res.data.msg,
						type: 'success'
						});
						this.$router.push('/notes')
					}else{
						this.$message.error(res.data.msg);
					}
				}).catch((error)=>{
					console.log(error,"新建预约须知失败")
				})
			}
		}
	}
</script>
<style lang='scss'>
	#notesAdd{
		.screen{
			position: fixed;
			top: 0;
			left: 0;
			right: 0;
			bottom: 0;
		}
		.notes-cont {
			background: #fff;
			margin-top: 24px;
			padding: 40px;
			font-size: 14px;
			display: flex;
			justify-content: center;
			.el-form{
				width: 70%;
			}
			.el-form-item__content{
				text-align: left;
				.el-icon-info{
					color:#808492;
					font-size: 16px;
					margin-top: 2px;
					margin-left: 6px;
				}
				.el-radio{
					margin-right: 20px;
				}
				.custom-textarea textarea{
					width: 80%;
					height: 160px;
				}
				.custom-btn{
					width:120px;
					height: 32px;
					line-height: 32px;
					padding: 0;
					margin-top: 20px;
				}
			}
		}
	}
</style>
